<?php
require_once("./Model/m_Logger.php");
class RegisterView {
	private $m_user = 'usernamer';
	private $m_email = 'email';
	private $m_password = 'password';
	private $m_password2 = 'password2';
	private $m_registerButton = 'register';
	private $m_abortButton = 'abort';
	
	public function RegisterForm(){
		return "
				<p>Criteria for registration</p>
				<dl>
				<dt>Username must:</dt>
				<dd>- be 3-15 charachters</dd>
				<dd>- Only contain a-Z 0-9 _ - & /</dd>
				<dt>E-Mail must:</dt>
				<dd>- be a valid address</dd>
				<dt>Password must:</dt>
				<dd>- contain atleast ONE capital letter</dd>
				<dd>- contain atleast ONE digit</dd>
				<dd>- be 8-16 characters long</dd>
				</dl>
				
				<form method='post'><label for='username'>Choose a username: </label>
				<input type='text' name='$this->m_user' id='username' /><br />
				<label for='email'>Enter your email: </label>
				<input type='text' name='$this->m_email' id='email' /><br />
				<label for='password'>Enter a password: </label>
				<input type='password' name='$this->m_password' id='password' /><br >
				<label for='password2'>Re-Enter Password: </label>
				<input type='password' name='$this->m_password2' id='password2' /><br >
				<input type='submit' name='$this->m_registerButton' value='Register' />
				<input type='submit' name='$this->m_abortButton' value='Abort' />
			</form>";
	}
	public function BannerBox(){
		return "<h2>Registration Controller</h2>";
	}
    public function GetUsername(){
    	if (isset( $_POST[$this->m_user]) == true) {
    		return $_POST[$this->m_user];
    	} 
    	return NULL;
  	}
  	public function GetEmail(){
    	if (isset( $_POST[$this->m_email]) == true) {
    		return $_POST[$this->m_email];
    	} 
    	return NULL;
  	}	
    public function GetPassword(){
    	if (isset( $_POST[$this->m_password]) == true) {
    		return $_POST[$this->m_password];
    	} 
    	return NULL;
  	}
	public function GetPassword2(){
    	if (isset( $_POST[$this->m_password2]) == true) {
    		return $_POST[$this->m_password2];
    	} 
    	return NULL;
  	}
	    public function TriedToRegister(){
	    if (isset( $_POST[$this->m_registerButton])) {
	      	return true;
	      }
	    return false;
  	}
  
    public function TriedToAbort(){
	    if (isset( $_POST[$this->m_abortButton])) {
	    	return TRUE;
	    } 
	    return FALSE;
  	}
}
